import Vue from 'vue'
import VueRouter from 'vue-router'
import { Form } from 'vant'


Vue.use(VueRouter)

const routes = [{ //重定向到主页面
        path: '/',
        redirect: '/home'
    },
    { //其他未定义页面全部指向404页面
        path: '*',
        component: () =>
            import ('@/views/NoFound404'),
    },
    {
        path: '/indexsearch',
        component: () =>
            import ('@/components/Indextab/search.vue')
    },
    { //主页面
        path: '/home',
        component: () =>
            import ('@/views/Home'),
        children: [{ //重定向主页面至首页
                path: '',
                redirect: '/index'
            },
            { //首页
                path: '/index',
                component: () =>
                    import ("@/components/Home/Index"),
                children: [{
                        path: '/',
                        component: () =>
                            import ("@/components/Indextab/indexarticle.vue")
                    },
                    {
                        path: '/indexart',
                        component: () =>
                            import ("@/components/Indextab/indexarticle.vue")
                    },
                    {
                        path: '/walk',
                        component: () =>
                            import ("@/components/Indextab/walk.vue")
                    },
                    {
                        path: '/sleep',
                        component: () =>
                            import ("@/components/Indextab/sleep.vue")
                    },
                    {
                        path: '/cook',
                        component: () =>
                            import ("@/components/Indextab/cook.vue")
                    },
                    {
                        path: '/dress',
                        component: () =>
                            import ("@/components/Indextab/dress.vue")
                    },
                    {
                        path: '/free',
                        component: () =>
                            import ("@/components/Indextab/free.vue")
                    },
                    {
                        path: '/child',
                        component: () =>
                            import ("@/components/Indextab/child.vue")
                    },
                    {
                        path: '/housework',
                        component: () =>
                            import ("@/components/Indextab/housework.vue")
                    },
                    {
                        path: '/size',
                        component: () =>
                            import ("@/components/Indextab/size.vue")
                    },
                ]
            },
            { //分类页
                path: '/classify',
                component: () =>
                    import ("@/components/Home/Classify")
            },
            { //专题页
                path: '/special',
                component: () =>
                    import ("@/components/Home/Special"),
            },
            { //购物车页
                path: '/cart',
                component: () =>
                    import ("@/components/Home/Cart"),
                meta: { requiresAuth: true }
            },
            { //我的页面
                path: '/mine',
                component: () =>
                    import ("@/components/Home/Mine"),
                children: [{ //检测到token不存在，进入此页面，登入的主页面--黄洪月
                        path: 'NotLogin',
                        component: () =>
                            import ("@/components/Home/Mine/NotLogin"),
                    },
                    { //进入会员权益页面--黄洪月
                        path: 'vipRights/:uid',
                        component: () =>
                            import ("@/components/Home/Mine/VipRights"),
                    },
                    { //进入我的订单页面--黄洪月
                        path: 'InMine/Order/:index',
                        component: () =>
                            import ("@/components/Home/Mine/Order"),
                    },
                    { //进入历史订单页面--黄洪月
                        path: 'InMine/history',
                        component: () =>
                            import ("@/components/Home/Mine/History"),
                    },
                    { //进入订单搜索页面--黄洪月
                        path: 'InMine/searchOrder',
                        component: () =>
                            import ("@/components/Home/Mine/SearchOrder"),
                    },
                    { //进入我的月礼页面--黄洪月
                        path: 'InMine/myMonthGift',
                        component: () =>
                            import ("@/components/Home/Mine/MyMonthGift"),
                    },
                    { //进入我的卡券页面--黄洪月
                        path: 'InMine/myCoupon',
                        component: () =>
                            import ("@/components/Home/Mine/MyCoupon"),
                    },
                    { //进入我的积分钱包页面--黄洪月
                        path: 'InMine/myGrade',
                        component: () =>
                            import ("@/components/Home/Mine/MyGrade"),
                    },
                    { //进入我的卡券页面--黄洪月
                        path: 'InMine/loveABS',
                        component: () =>
                            import ("@/components/Home/Mine/LoveABS"),
                    },
                    { //进入我的消息页面--黄洪月
                        path: 'InMine/myNews',
                        component: () =>
                            import ("@/components/Home/Mine/MyNews"),
                    },
                ],
            },
        ]
    },
    { //登入页面
        path: '/login',
        component: () =>
            import ('@/views/Login'),
        children: [{ //重定向至登入主页面
                path: '',
                redirect: '/loginindex'
            },
            { //登入的主页面
                path: '/loginindex',
                component: () =>
                    import ("@/components/Login/LoginIndex.vue")
            },
            { //登入表单的页面
                path: '/loginform',
                component: () =>
                    import ("@/components/Login/LoginForm.vue")
            }
        ]
    },
    { // 尝试跳到我的=>管理收货地址页面--陈俊
        path: '/MSaddress',
        component: () =>
            import ("@/components/Home/Mine/MSaddress"),

    },
    { // 跳到我的=>新增收货地址页面--陈俊
        path: '/Newaddress',
        component: () =>
            import ("@/components/Home/Mine/Newaddress")
    },
    { //商品列表页--路盼盼
        path: '/goodslist',
        component: () =>
            import ("@/views/GoodsList")
    },

    { //准备购买页面--游露婷
        path: '/readybuy',
        component: () =>
            import ('@/components/Home/Cart/ShopReady'),
    },
    { //结算页面--游露婷
        path: '/readybuy',
        component: () =>
            import ('@/components/Home/Cart/ShopReady'),
    },
    { //个人信息页面--游露婷
        path: '/changemineinfo',
        component: () =>
            import ('@/components/Home/Mine/ChangeMineInfo'),
    },
    { //支付方式--游露婷
        path: '/payment',
        component: () =>
            import ('@/components/Home/Cart/Payment'),
    },

    { //商品列表页--路盼盼
        path: '/goodslist',
        component: () =>
            import ("@/views/GoodsList")
    },
    { //设置页面--路盼盼
        path: '/setting',
        component: () =>
            import ('@/views/Setting')
    },
    { //设置页面里的账户与安全页面-路盼盼
        path: '/account',
        component: () =>
            import ("@/views/AccountSecurity")

    },
    { //设置页面里的意见与反馈页面-路盼盼
        path: '/feedback',
        component: () =>
            import ('@/views/FeedBack')
    },
    {
        path: '/detail/:id',
        component: () =>
            import ('../views/Detail.vue')
    }
]

const router = new VueRouter({
    routes
})

export default router